 #Include <ScreenCapture.au3>
#Include <File.au3>
#Include <GuiListView.au3>
#include <GUIComboBox.au3>
#Include <GuiTreeView.au3>
#include <GUIListBox.au3>
#include <GuiButton.au3>
#Include <GuiMenu.au3>
#Include <GuiTab.au3>
#Include <Function for OCR.au3>

Common_WriteCurrentFunctionNameToTempTXT($sOCRFunctionName)

Dim $bDebug = False

If Not $bDebug Then
	OCR1_1_1()
	OCR1_1_2()
	OCR1_1_4()
	OCR1_1_5()
	OCR1_1_7()
	OCR1_1_8()
	OCR2_1_1()
	OCR2_1_3()
	OCR2_1_4()
	If Not $bPageViewType Then
		OCR4_1_2()
		OCR6_1_1()
		OCR7_1_1()
	EndIf
	CloseOpenedExcel($oExcel)
	OCR3_1_x() 
EndIf

Func OCR1_1_1()
	Local $TestCaseID = "1.1.1" 
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
    If ControlCommand($hPMHandle,"",$sOCRButtonInToolbarCtrInfo,"IsEnabled", "") Then
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase) 
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
    Else
	    Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1
    EndIf
EndFunc

Func OCR1_1_2()
	Local $TestCaseID = "1.1.2" 
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Send("!t")   ; Open "Tool" menu.
	Common_SleepTime(4)
	Local $hMenu = WinGetHandle($sMenuCtrInfo)
	Common_ScreenCaprureWindow($sTestResultPath , $sCaptureImage, $hMenu) 
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
    If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1
    Else
	    Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
    EndIf
EndFunc

Func OCR1_1_4()
	Local $TestCaseID = "1.1.4" 
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & '8_Bit_Gray.jpg', $sFunctionFolderPath, 1)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
	Common_SleepTime(4) 
    If ControlCommand($hPMHandle,"",$sOCRButtonInToolbarCtrInfo,"IsEnabled", "") Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1
    Else
	    Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
    EndIf
EndFunc

Func OCR1_1_5()
	Local $TestCaseID = "1.1.5"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & '8_Bit_Gray.jpg', $sFunctionFolderPath, 1)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(1)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
    Send("!t")   ; Open "Tool" menu.
	Common_SleepTime(4)
	Local $hMenu = WinGetHandle($sMenuCtrInfo)
	Common_ScreenCaprureWindow($sTestResultPath , $sCaptureImage, $hMenu)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
    If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1
    Else
	    Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
    EndIf
EndFunc

Func OCR1_1_7()
	Local $TestCaseID = "1.1.7"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(2) 
	_GUICtrlListView_ClickItem($hThumbnailView, 59)
	Common_SleepTime(7) 
    If ControlCommand($hPMHandle,"",$sOCRButtonInToolbarCtrInfo,"IsEnabled", "") = 0 Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
    Else
		Common_WriteLog($sFaile & $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1
    EndIf	
EndFunc

Func OCR1_1_8()
	Local $TestCaseID = "1.1.8"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(4) 
	_GUICtrlListView_ClickItem($hThumbnailView, 59)
	Common_SleepTime(2) 
    Send("!t")   ; Open "Tool" menu.
	Common_SleepTime(4)
	Local $hMenu = WinGetHandle($sMenuCtrInfo)
	Common_ScreenCaprureWindow($sTestResultPath , $sCaptureImage, $hMenu)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR2_1_1()
	Local $TestCaseID = "2.1.1"
	$sCusMsg = 'The image is OCR view'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & '8_Bit_Gray.jpg', $sFunctionFolderPath, 1)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & '32_Bit_Color.bmp', $sFunctionFolderPath, 1)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BW_100DPI.TIF', $sFunctionFolderPath, 1)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_CMYK.jpg', $sFunctionFolderPath, 1)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_Color.jpg', $sFunctionFolderPath, 1)
	Common_SleepTime(4) 
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	Common_SleepTime(4) 
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo,"Select", 1 ,2)
	Common_SleepTime(1) 
	ControlClick($hPMHandle,"",$sOCRButtonInToolbarCtrInfo)
	Common_SleepTime($sPerformOCRTime) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage,$hOCR)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR2_1_2()
	Local $TestCaseID = "2.1.2"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(4) 
	_GUICtrlListView_ClickItem(ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo), 57 , "left", True) 
	Sleep(1000)
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo,"Select", 57 ,58)
	Common_SleepTime(20) 
	Local $shHandle = WinGetHandle($hPMHandle)
	ControlClick($hPMHandle,"",$sOCRButtonInToolbarCtrInfo)
	Common_SleepTime($sPerformOCRTime) 
	Common_SleepTime(50) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage,$hOCR)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile&$sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR2_1_3()
	Local $TestCaseID = "2.1.3"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(4) 
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo,"Select", 58 ,59)
	Common_SleepTime(4) 
    If ControlCommand($hPMHandle,"",$sOCRButtonInToolbarCtrInfo,"IsEnabled", "") Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
    Else
	    Common_WriteLog($sFaile & $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1 
    EndIf	
EndFunc

Func OCR2_1_4()
	Local $TestCaseID = "2.1.4" 
	$sCusMsg = 'The image is OCR view of stack files'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
	Common_SleepTime(1)
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo, "Select" ,1,2)
	Common_SleepTime(2) 
	Local $shHandle = WinGetHandle($hPMHandle)
	ControlClick($shHandle,"",$sStackButtonInToolbarCtrInfo)
	Common_SleepTime(4) 
	ControlClick($shHandle,"",$sOCRButtonInToolbarCtrInfo)
	Common_SleepTime($sPerformOCRTime) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage,ControlGetHandle($hPMHandle, "",'AfxMDIFrame424'))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR2_1_5()
	Local $TestCaseID = "2.1.5" 
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(4) 
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo,"Select", 1 )
	Common_SleepTime(2) 
	Local $shHandle = WinGetHandle($hPMHandle)
	ControlClick($shHandle,"",$sOCRButtonInToolbarCtrInfo)
	Common_SleepTime($sPerformOCRTime) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage,$hOCR)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile&$sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR3_1_x()
	Local $FileList=_FileListToArray($sOCR_LANGUAGES_SMAPLE_PATH, "*", 1)
	If @error Then 
		Common_WriteLog($sFaile& ': Error in Local $FileList=_FileListToArray($sOCR_LANGUAGES_SMAPLE_PATH, "*", 1)', "Begining",$sOCRFunctionName,'')  
		Return False		
	EndIf
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex('OCR3_1_x', $sOCRFunctionName)
	ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	For $n = 0 To 57
		Local $j=$n+($n+1)
		Local $TestCaseID = "3.1."&$j
		#cs
		Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
		If $bReproduceTestCase = False Then
			Return 3   
		EndIf
		Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
		Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
		If $bExecuteTestCase = False Then
			Return 2   
		EndIf 
		#ce
		Local $sCaptureImage = $TestCaseID & '.jpg'  
		If ($n + 1) < $FileList[0] Then
			FileCopy($sOCR_LANGUAGES_SMAPLE_PATH & $FileList[$n + 1], $sFunctionFolderPath, 1)
		EndIf
		ControlClick($hPMHandle,"",$sPreferencesButtonInToolbarCtrInfo) ;Preferences
		If Not WinWait('Preferences', '', 60) Then   
			Common_SleepInSeconds(10)
			WinActivate($hPMHandle)
			Common_SleepInSeconds(1)
			ControlClick($hPMHandle,"",$sPreferencesButtonInToolbarCtrInfo) ;Preferences
			If Not WinWait('Preferences', '', 60) Then   
				Common_WriteLog($sFaile& ": Error in ControlClick($hPMHandle,"",$sPreferencesButtonInToolbarCtrInfo)", $TestCaseID,$sOCRFunctionName,'')  
				Return False
			EndIf	
		EndIf
		Common_SleepInSeconds(1)
		Local $hPtable=ControlGetHandle($sPreferencesDialogTitle,"",$sPreferencesTabControl)
		Local $hThumbnail=ControlGetHandle( $hPMHandle, "", $sThumbnailViewCtrInfo)
		If $hThumbnail == '' Then $hThumbnail = ControlGetHandle( $hPMHandle, "", 'SysListView322')
		_GUICtrlTab_ClickTab($hPtable, $sOCRLableIndex, "left");  2_OCR
		Common_SleepInSeconds(1)
		Local $hPlist=ControlGetHandle($sPreferencesDialogTitle,"",$sOCRLanguageListBox)
		_GUICtrlListBox_SetCurSel($hPlist, $n)
		Common_SleepInSeconds(4)
		WinActivate($sPreferencesDialogTitle)
		ControlClick($sPreferencesDialogTitle,"",1)
		Common_SleepInSeconds(2)
		Send('{F5}')
		Common_SleepInSeconds(2)
		_GUICtrlListView_ClickItem($hThumbnail, 0, "left") 
		Common_SleepInSeconds(0.5)		
		ControlClick($hPMHandle,"",$sOCRButtonInToolbarCtrInfo)
		Common_SleepTime($sPerformOCRTime) 
		Common_SleepInSeconds(20)
		If $bPageViewType Then
			Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
		Else
			Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
		EndIf
		Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage,$hOCR)
		Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
		If $bCompareFile Then
			Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,'')	
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Else
			Common_WriteLog($sFaile& ":Please check "&$sCaptureImage, $TestCaseID,$sOCRFunctionName,'')  
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		EndIf
		Common_SleepTime()
		Local $k=$j+1
		Local $TestCaseID1 = "3.1."&$k
		Local $posOCRResultView = ControlGetPos($hPMHandle, "",$hOCR)
		Common_SleepTime(2)
		If $bPageViewType Then
			MouseClick('right', 610, 366)
			Common_SleepInSeconds(1)
			Send('{DOWN}')
			Common_SleepInSeconds(0.3)
			Send('{DOWN}')
			Common_SleepInSeconds(0.3)	
			Send('{ENTER}')
			WinWaitActive($sSaveAsDialogClass,"FolderView")
			Common_SleepInSeconds(2)
			ControlSetText($sSaveAsDialogClass,"FolderView",1148,$sTestResultPath&$TestCaseID1)
		Else			
			ControlClick($hPMHandle,"",$sSaveAsButtonInToolbarCtrInfo);Save
			WinWaitActive($sSaveAsDialogClass,"FolderView")
			Common_SleepInSeconds(2)
			ControlSetText($sSaveAsDialogClass,"FolderView",$sSaveAsDialogNameEditBox,$sTestResultPath&$TestCaseID1)
		EndIf	
		Common_SleepTime(2)
		ControlClick($sSaveAsDialogClass,"FolderView",$sSaveAsDialogTypeComboBox)
		Common_SleepTime(1)
		Common_SetSaveAsFormat('Rich Text Format(*.RTF)')
		ControlClick($sSaveAsDialogClass,"Save",$sSaveAsDialogSaveButton)
		Common_SleepTime(5)
		Local $bCompareFile = Common_CompareFile($sTestResultPath & $TestCaseID1&".rtf", $sCorrectResultPath & $TestCaseID1&".rtf")  
		If $bCompareFile Then
			Common_WriteLog($sPass, $TestCaseID1,$sOCRFunctionName,'')	
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID1)
		Else
			Common_WriteLog($sFaile& ":Please check "& $TestCaseID1&".rtf", $TestCaseID1,$sOCRFunctionName,'') 
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID1)
		EndIf
		If $bPageViewType Then
			MouseClick('left', 37, 55)
			Common_SleepInSeconds(2)
		Else
			ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		EndIf
		FileDelete($sFunctionFolderPath & $FileList[$n + 1])	
	Next
	Common_Close_PM($hPMHandle)	
EndFunc

Func OCR4_1_1()
	Local $TestCaseID = "4.1.1"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
	Common_SleepTime(1)
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo, "Select" ,57,58)
	Common_SleepTime(2) 
	Send("!t")
	Common_SleepTime(6)
	Send("o")
	Common_SleepTime(14) 
	
	Common_ScreenCaprureWindow($sTestResultPath , $sCaptureImage,WinGetHandle('')) 
	
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR4_1_2()
	Local $TestCaseID = "4.1.2"
	$sCusMsg = 'The image is OCR view'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
	Common_SleepTime(1)
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo, "Select" ,1,2)
	_GUICtrlListView_ClickItem($hThumbnailView,2,"right")
	Common_SleepTime(2) 
	Send("{down}")
	Sleep(300)
	Send("{down}")
	Sleep(300)
	Send("{right}")
	Sleep(300)
	Send("{up}")
	Sleep(300)
	Send("{enter}")
	Common_SleepTime(60) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage, ControlGetHandle($hPMHandle, '', $hOCR))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR5_1_1()
	Local $TestCaseID = "5.1.1"
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 57)
	Common_SleepTime(2)
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo, "Select" ,57,58)
	Common_SleepTime(2) 
	Local $shHandle = WinGetHandle($hPMHandle)
	ControlClick($shHandle,"",$sOCRButtonInToolbarCtrInfo)
	Common_SleepTime(15)	
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath , $sCaptureImage,ControlGetHandle($hPMHandle, '', $hOCR)) 
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile&$sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR6_1_1()
	Local $TestCaseID = "6.1.1" 
	$sCusMsg = 'The image is OCR view'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	ControlClick($hPMHandle,"",31002) ;Title view
	Common_SleepTime(4) 
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(4) 
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo,"Select", 1 ,0)
	Common_SleepTime(2)
	Local $shHandle = WinGetHandle($hPMHandle)
	ControlClick($shHandle,"",$sOCRButtonInToolbarCtrInfo)
	Common_SleepTime(30) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage, ControlGetHandle($hPMHandle, '', $hOCR))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc

Func OCR7_1_1()
	Local $TestCaseID = "7.1.1" 
	$sCusMsg = 'The image is OCR view'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sOCRFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sOCRFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForOCR()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionNameOCR)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(4) 
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo,"Select", 1 ,0)
	Common_SleepTime(6) 
	ControlClick($hPMHandle,"",1034) ;Page view
	Common_SleepTime(12)
	
	If $bPageViewType Then
		If WinWaitActive($sPageViwerWindowClass,'',10) Then
			Local $shHandle = WinGetHandle($sPageViwerWindowClass)
			Send("!t")
			Common_SleepTime(1)
			Send("o")
		Else
			Common_WriteLog($sFaile &$sFailLogMsg , $TestCaseID,$sFindFunctionName,$bReproduceTestCase)
			Common_Close_PM($hPMHandle) 
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
			Return 0
		EndIf
	Else
		ControlClick($hPMHandle,"",$sOCRButtonInToolbarCtrInfo)
	EndIf
	
	Common_SleepTime(30) 
	If $bPageViewType Then
		Local $hOCR = ControlGetHandle(WinGetHandle($sPageViwerWindowClass), "",$sOCRResultView)
	Else
		Local $hOCR = ControlGetHandle($hPMHandle, "",$sOCRResultView)
	EndIf
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage, ControlGetHandle($hPMHandle, '', $hOCR))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  
	If $bCompareFile Then
		Common_WriteLog($sPass, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 		
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	Else
		Common_WriteLog($sFaile& $sFailLogMsg, $TestCaseID,$sOCRFunctionName,$bReproduceTestCase)  
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 0
	EndIf
EndFunc
